Page({
  data: {
    repairList: []
  },
  onShow() {
    this.getRepairtList()
  },
  async getRepairtList() {
    const { code, data: { rows: repairList } } = await wx.http.get('/repair', { current: 1, pageSize: 20 })
    if (code !== 10000) return wx.utils.toast('获取保修列表失败')
    this.setData({
      repairList,
      isEnpty: repairList.length === 0
    })
  },
  goDetail(event) {
    wx.navigateTo({
      url: `/repair_pkg/pages/detail/index?id=${event.mark.id}`
    })
  },
  addRepair() {
    wx.navigateTo({
      url: '/repair_pkg/pages/form/index'
    })
  }
})
